package com.foreknow.demo4;

import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) {
        while (true) {
            Scanner sc = new Scanner(System.in);
            System.out.println("请输入成绩：");
            double score = sc.nextDouble();
            int grade = (int) (score / 10);
            if (score < 0 || score > 100) {
                System.out.println("成绩输入有误，请重新输入！");
                continue;
            } else {
                switch (grade) {
                    case 10:
                    case 9:
                        System.out.println("等级为A");
                        break;
                    case 8:
                    case 7:
                        System.out.println("等级为B");
                        break;
                    case 6:
                        System.out.println("等级为C");
                        break;
                    case 5:
                    case 4:
                    case 3:
                    case 2:
                    case 1:
                    case 0:
                        System.out.println("等级为D");
                        break;
                }
            }
        }
    }
}
